package com.edu.whty.dao;


import com.edu.whty.dao.base.IBaseDao;
import com.edu.whty.entity.disk.ResOwner;
import com.edu.whty.entity.share.ResShare;

import java.util.List;
import java.util.Map;

/**
 * @desc	资源分享表DAO接口类
 * @author	
 * @date	2014-11-25
 */
public interface ResShareDao extends IBaseDao {

    /**
     * 查询单条记录
     * @param model
     * @return
     * @throws Exception
     */
    ResShare selectOne(ResShare model) throws Exception;

    List<ResShare> selectList(ResShare resShare) throws Exception;
    

    /**
     * 插入
     * @param model
     * @throws Exception
     */
    void insertOne(ResShare model) throws Exception;

    void batchInsert(List<ResShare> list) throws Exception;

    /**
     * 更新
     * @param model
     * @throws Exception
     */
    void updateOne(ResShare model) throws Exception;

    /**
     * 删除
     * @param shareId
     * @throws Exception
     */
    void deleteOne(String shareId) throws Exception;
    
    /**
     * 根据userid查询一条数据，用于获取该用户的userAvatar(分享者缩略图)
     * @param userid
     * @author 冯光亮
     */
    ResShare getResShareByUserid(String userid) throws Exception;

    /**
     * 个人网盘7.0 根据userid获取分享总记录数目
     * @param userId
     * @return
     */
    Integer countResShare(String userId);

    /**
     * 个人网盘7.0 分页查询分享总记录数目
     * @param params
     * @return
     */
    List<ResShare> selectForPagination7(Map<String, Object> params);

    /**
     * 根据短码值删除
     * @param shortCode
     * @return
     */
    void deleteByShortCode(String shortCode);

    /**
     * 根据短码获取分享文件信息
     * @param shortCode
     * @return
     */
    List<ResShare> selectByshortCode(String shortCode);

    /**
     * 根据短码值获取分享文件信息
     * @return
     */
    List<ResOwner> selectResOwnerByShortCode(String shortCode);

    /**
     * 根据resId判断是否有分享的数据
     * @param resId
     * @return
     */
    List<ResShare> selectByResid(String resId);

    void deleteByShareId(ResShare resShare) throws Exception;
}
